package org.example.taobao.demo.good.controller;

import org.example.taobao.demo.good.repository.entity.GoodDO;
import org.example.taobao.demo.good.vo.GoodVO;

/**
 * @author zhangxx
 * @date 2022/6/9 10:54 PM
 */
public class GoodConvert {

    public static GoodDO toDO(GoodVO goodVO) {
        return GoodDO.builder()
                .stock(goodVO.getStock())
                .goodName(goodVO.getGoodName())
                .price(goodVO.getPrice())
                .goodId(goodVO.getGoodId())
                .build();
    }

    public static GoodVO toVO(GoodDO goodDO) {
        return new GoodVO(goodDO.getGoodId(), goodDO.getGoodName(), goodDO.getStock(), goodDO.getPrice());
    }
}
